﻿using System;

namespace ComTools.Queue
{

    /// <summary>
    /// 队列状态
    /// </summary>
    public class QueueStatus
    {
        /// <summary>
        /// 队列处理器的状态：繁忙/空闲
        /// </summary>
        public readonly QueueProcessState State;

        /// <summary>
        /// 队列中数据的总数
        /// </summary>
        public readonly int Count;

        /// <summary>
        /// 最后一次处理的时间
        /// </summary>
        public readonly DateTime LastProcessDate;

        /// <summary>
        /// 每次出列的数据数量
        /// </summary>
        public readonly int DequeueSize;

        /// <summary>
        /// 已经处理了的次数
        /// </summary>
        public readonly int NumberOfTimesProcessed;

        /// <summary>
        /// 自上次处理后过去的时间
        /// </summary>
        public readonly TimeSpan ElapsedTimeSinceLastProcessDate;

        /// <summary>
        /// 已经处理的数据总数
        /// </summary>
        public readonly int TotalProcessed;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="state">队列处理器的状态</param>
        /// <param name="countItemsRemaining">队列中剩余数据的总数</param>
        /// <param name="lastProcessDate">最后一次处理的时间</param>
        /// <param name="numberOfTimesProcessed">处理的次数</param>
        /// <param name="elaspedTime">自上次处理后过去的时间</param>
        /// <param name="totalProcessed">已经处理数据的总数</param>
        /// <param name="dequeueSize">每次出列处理的数据数量</param>
        public QueueStatus(QueueProcessState state, int countItemsRemaining, DateTime lastProcessDate, int numberOfTimesProcessed, TimeSpan elaspedTime, int totalProcessed, int dequeueSize)
        {
            State = state;
            Count = countItemsRemaining;
            NumberOfTimesProcessed = numberOfTimesProcessed;
            LastProcessDate = lastProcessDate;
            DequeueSize = dequeueSize;
            ElapsedTimeSinceLastProcessDate = elaspedTime;
            TotalProcessed = totalProcessed;
        }
    }
}
